
<script language="javascript" src="modules/VoteDataCenter/pnajax/ajax_list_moo.js"></script>
<fieldset>
  <legend>&nbsp;Report&nbsp;filter&nbsp;</legend>
  <form method=post action="<!--[pnmodurl modname='VoteDataCenter' type='remark' func='report']-->">
      <span id="form_province">
        <!--[if $smarty.request.form.pro_id]-->
          <!--[selector_object_array_ex 
                modname="VoteDataCenter" 
                class="Province" 
                field="id" 
                displayField="name"  
                name="form[pro_id]" 
                selectedValue=$smarty.request.form.pro_id
                allValue="0"
                allText="ทุกจังหวัด"
                sort="pro_name"
                onChange="getKhet()"
          ]-->
        <!--[else]-->
          <!--[selector_object_array_ex 
                modname="VoteDataCenter" 
                class="Province" 
                field="id" 
                displayField="name"  
                name="form[pro_id]" 
                selectedValue=$form.id 
                allValue="0"
                allText="ทุกจังหวัด"
                sort="pro_name"
                onChange="getKhet()"
          ]-->
        <!--[/if]-->
      </span>
      <span id="form_khet">
        <!--[if $smarty.request.form.pro_id]-->
          <select name="form[khet_id]" id="form_khet_id_" onchange="getDistrictByProvinceID()">
              <option value="0">ทุกเขต</option>
              <option value="1" <!--[if $smarty.request.form.khet_id == 1]-->SELECTED<!--[/if]-->>เขต1</option>
              <option value="2" <!--[if $smarty.request.form.khet_id == 2]-->SELECTED<!--[/if]-->>เขต2</option>
              <option value="3" <!--[if $smarty.request.form.khet_id == 3]-->SELECTED<!--[/if]-->>เขต3</option>
          </select>
        <!--[else]-->

        <!--[/if]-->
      </span>
      <span id="form_district">
          <!--[if (isset($smarty.request.form.dis_id) || $smarty.request.form.dis_id == 0) && $smarty.request.form.pro_id]-->
            <!--[selector_object_array_ex modname="VoteDataCenter" 
                    class="District" 
                    field="id" 
                    displayField="name"  
                    name="form[dis_id]" 
                    selectedValue=$smarty.request.form.dis_id
                    queryField = dis_pro_id
                    queryValue = $smarty.request.form.pro_id
                    allValue="0"
                    allText="ทุกอำเภอ"
                    sort="dis_name"
                    onChange="getTambonByDistrictID()"
            ]-->
          <!--[else]-->

          <!--[/if]-->
      </span>
      <span id="form_tambon">
          <!--[if $smarty.request.form.dis_id && $smarty.request.form.pro_id && ($smarty.request.form.tam_id || $smarty.request.form.tam_id == 0 )]-->
            <!--[selector_object_array_ex 
                    modname="VoteDataCenter" 
                    class="Tambon" 
                    field="id" 
                    displayField="name"  
                    name="form[tam_id]" 
                    selectedValue=$smarty.request.form.tam_id
                    queryField = tam_dis_id
                    queryValue = $smarty.request.form.dis_id
                    allValue="0"
                    allText="ทุกตำบล"
                    sort="tam_name"
                    onChange="getVillageByTambonID()"
            ]-->
          <!--[else]-->

          <!--[/if]-->
      </span>
      <span id="form_village">
          <!--[if $smarty.request.form.dis_id && $smarty.request.form.pro_id && $smarty.request.form.tam_id && ($smarty.request.form.vil_id || $smarty.request.form.vil_id == 0 )]-->
            <!--[selector_object_array_ex 
                    modname="VoteDataCenter" 
                    class="Village" 
                    field="moo" 
                    displayField="moo"  
                    name="form[vil_id]" 
                    selectedValue=$smarty.request.form.vil_id
                    queryField = vil_tam_id
                    queryValue = $smarty.request.form.tam_id
                    allValue="0"
                    allText="ทุกหมู่"
                    sort="vil_moo"
            ]-->
          <!--[else]-->

          <!--[/if]-->
      </span>
    <input type="submit" value="submit">
  </form>
</fieldset>

<fieldset>
  <legend>&nbsp;Data&nbsp;</legend>
  <!--[if $objectArray]-->

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
    <title>
      Google Visualization API Sample
    </title>
    <script type="text/javascript" src="http://www.google.com/jsapi"></script>
    <script type="text/javascript">
      google.load('visualization', '1', {packages: ['corechart']});
    </script>
    <script type="text/javascript">
      function drawVisualization() {
        // Create and populate the data table.
        var data = new google.visualization.DataTable();
        data.addColumn('string', 'พรรค');
        data.addColumn('number', 'จำนวน');
        data.addRows(3);
  

        <!--[if $total_sum_we && $total_sum_they && $total_sum_unknown]-->
          data.setValue(0, 0, 'ประชาธิปัตย์');
          data.setValue(0, 1, <!--[$total_sum_we]-->);
          data.setValue(1, 0, 'เพื่อไทย');
          data.setValue(1, 1, <!--[$total_sum_they]-->);
          data.setValue(2, 0, 'ยังไม่ตัดสินใจ');
          data.setValue(2, 1, <!--[$total_sum_unknown]-->);
        <!--[else]-->
          data.setValue(0, 0, 'ประชาธิปัตย์');
          data.setValue(0, 1, <!--[$sum_count_we]-->);
          data.setValue(1, 0, 'เพื่อไทย');
          data.setValue(1, 1, <!--[$sum_count_they]-->);
          data.setValue(2, 0, 'ยังไม่ตัดสินใจ');
          data.setValue(2, 1, <!--[$sum_all_count_unknown]-->);
        <!--[/if]-->


        var k = document.getElementById("form_khet_id_");
        if(k){
          var khet = k.options[k.selectedIndex].text;
        }

        var d = document.getElementById("form_dis_id_");
        if(d){
        var district = " อ."+d.options[d.selectedIndex].text;
        }

        var t = document.getElementById("form_tam_id_");
        if(t){
        var tambon = " ต."+t.options[t.selectedIndex].text;
        }

        var m = document.getElementById("form_moo_id_");
        if(m){
        var tambon = " ม."+m.options[m.selectedIndex].text;
        }

        if(khet && district && tambon){
          var text = "ผลการหยั่งเสียงจากแกน "+khet+"  "+district+" "+tambon;
        }else if(khet && district){
          var text = "ผลการหยั่งเสียงจากแกน "+khet+"  "+district;
        }else {
          var text = "ผลการหยั่งเสียงจากแกน "+khet;
        }


        new google.visualization.PieChart(document.getElementById('visualization')).
        draw(data, {title:text});
      }
      
      google.setOnLoadCallback(drawVisualization);
    </script>
  </head>
  <body style="font-family: Arial;border: 0 none;">
<table>
<tr>
  <td align="center">
    <div id="visualization" style="width: 800px; height: 400px;">
    </div>
  </td>
</tr>
</table>
    
  </body>
</html>
  <table>
    <tr>
       <th width="100%" align="left" rowspan="5"><!--[$district_muang]--></th>
    </tr>
  </table>
  <table  width="100%">
    <tr bgcolor="#99CCCC">
      <th width="10%" align="center" rowspan="2">ข้อมูล</th>
      <th width="30%" align="center" colspan="2">ผู้มีสิทธิทั้งหมด</th>
      <th width="20%" align="center" colspan="2">ประชาธิปัตย์</th>
      <th width="20%" align="center" colspan="2">เพื่อไทย</th>
      <th width="20%" align="center" colspan="2">ยังไม่ตัดสินใจ</th>
    </tr>
    <tr bgcolor="#99CCCC">
      <th width="15%" align="center">จำนวน</th>
      <th width="15%" align="center">%</th>
      <th width="10%" align="center">จำนวน</th>
      <th width="10%" align="center">%</th>
      <th width="10%" align="center">จำนวน</th>
      <th width="10%" align="center">%</th>
      <th width="10%" align="center">จำนวน</th>
      <th width="10%" align="center">%</th>
    </tr>
     <!--[foreach from=$objectArray item=item]-->
      <tr align="right" bgcolor="<!--[cycle values='#FFFFFF,#E8EFF7']-->">
        <td align="left"><!--[$item.name]--></td>
        <td width="15%"><!--[$item.count_all]--></td>
        <td width="15%">100</td>
        <td width="10%">
          <!--[$item.count_we]-->
        </td>
          <!--[php]-->
            $item = $this->get_template_vars('item');

            $percent_count_we = number_format(($item['count_we']*100)/$item['count_all'], 2);

            if($percent_count_we >=91 && $percent_count_we <= 100){
              echo '<td width="10%" bgcolor ="#0099ff" >';
              echo $percent_count_we;
              echo '</td>';
            }else if($percent_count_we >=71 && $percent_count_we < 91){
              echo '<td width="10%" bgcolor ="#33cc00" >';
              echo $percent_count_we;
              echo '</td>';
            }else if($percent_count_we >=51 && $percent_count_we < 71){
              echo '<td width="10%" bgcolor ="#ffffcc" >';
              echo $percent_count_we;
              echo '</td>';
            }else if($percent_count_we >=1 && $percent_count_we < 51){
              echo '<td width="10%" bgcolor ="#ff3300" >';
              echo $percent_count_we;
              echo '</td>';
            }else if($percent_count_we  < 1){
              echo '<td width="10%" bgcolor ="#ffccff" >';
              echo $percent_count_we;
              echo '</td>';
            }
          <!--[/php]-->
        <td width="10%">
          <a href="<!--[pnmodurl modname='VoteDataCenter' type='remark' func='person' moo=$item.name select='they' tam_id=$tam_id]-->">
          <!--[$item.count_they]-->
          </a>
        </td>
          <!--[php]-->
            $percent_count_they = number_format(($item['count_they']*100)/$item['count_all'], 2);

            if($percent_count_they >=91 && $percent_count_they <= 100){
              echo '<td width="10%" bgcolor ="#0099ff" >';
              echo $percent_count_they;
              echo '</td>';
            }else if($percent_count_they >=71 && $percent_count_they < 91){
              echo '<td width="10%" bgcolor ="#33cc00" >';
              echo $percent_count_they;
              echo '</td>';
            }else if($percent_count_they >=51 && $percent_count_they < 71){
              echo '<td width="10%" bgcolor ="#ffffcc" >';
              echo $percent_count_they;
              echo '</td>';
            }else if($percent_count_they >=1 && $percent_count_they < 51){
              echo '<td width="10%" bgcolor ="#ff3300" >';
              echo $percent_count_they;
              echo '</td>';
            }else if($percent_count_they  < 1){
              echo '<td width="10%" bgcolor ="#ffccff" >';
              echo $percent_count_they;
              echo '</td>';
            }
          <!--[/php]-->
        <td width="10%">
          <a href="<!--[pnmodurl modname='VoteDataCenter' type='remark' func='person' moo=$item.name select='unknown' tam_id=$tam_id]-->">
            <!--[$item.count_unknown]-->
          </a>
        </td>
          <!--[php]-->
            $percent_unknown = number_format(($item['count_unknown']*100)/$item['count_all'], 2);

            if($percent_unknown >=91 && $percent_unknown <= 100){
              echo '<td width="10%" bgcolor ="#0099ff" >';
              echo $percent_unknown;
              echo '</td>';
            }else if($percent_unknown >=71 && $percent_unknown < 91){
              echo '<td width="10%" bgcolor ="#33cc00" >';
              echo $percent_unknown;
              echo '</td>';
            }else if($percent_unknown >=51 && $percent_unknown < 71){
              echo '<td width="10%" bgcolor ="#ffffcc" >';
              echo $percent_unknown;
              echo '</td>';
            }else if($percent_unknown >=1 && $percent_unknown < 51){
              echo '<td width="10%" bgcolor ="#ff3300" >';
              echo $percent_unknown;
              echo '</td>';
            }else if($percent_unknown < 1){
              echo '<td width="10%" bgcolor ="#ffccff" >';
              echo $percent_unknown;
              echo '</td>';
            }
          <!--[/php]-->
      </tr>
     <!--[/foreach]-->
      <!--[php]-->
        $sum_count_all = $this->get_template_vars('sum_count_all');
        $sum_count_we = $this->get_template_vars('sum_count_we');
        $sum_percent_we = number_format(($sum_count_we*100)/$sum_count_all, 2);

        $sum_count_they = $this->get_template_vars('sum_count_they');
        $sum_percent_they = number_format(($sum_count_they*100)/$sum_count_all, 2);

        $sum_count_none_canvasser = $this->get_template_vars('sum_count_none_canvasser');
        $sum_none_canvasser = number_format(($sum_count_none_canvasser*100)/$sum_count_all, 2);

        $sum_count_unknown = $this->get_template_vars('sum_count_unknown');
        $sum_percent_unknown = number_format((($sum_count_unknown*100)/$sum_count_all), 2, ".", ",");


        $sum_all_count_unknown = $this->get_template_vars('sum_all_count_unknown');
        $sum_percent_all_count_unknown = number_format((($sum_all_count_unknown*100)/$sum_count_all), 2, ".", ",");



      <!--[/php]-->
      <tr align="right" bgcolor="<!--[cycle values='#FFFFFF,#E8EFF7']-->">
        <th ><b>รวม</b></td>
        <th><!--[$sum_count_all]--></th>
        <th>100</th>
        <th><!--[$sum_count_we]--></th>
          <!--[php]-->
            if($sum_percent_we >=91 && $sum_percent_we <= 100){
              echo '<th width="10%" bgcolor ="#0099ff" >';
              echo $sum_percent_we;
              echo '</th>';
            }else if($sum_percent_we >=71 && $sum_percent_we < 91){
              echo '<th width="10%" bgcolor ="#33cc00" >';
              echo $sum_percent_we;
              echo '</th>';
            }else if($sum_percent_we >=51 && $sum_percent_we < 71){
              echo '<th width="10%" bgcolor ="#ffffcc" >';
              echo $sum_percent_we;
              echo '</th>';
            }else if($sum_percent_we >=1 && $sum_percent_we < 51){
              echo '<th width="10%" bgcolor ="#ff3300" >';
              echo $sum_percent_we;
              echo '</th>';
            }else if($sum_percent_we < 1){
              echo '<th width="10%" bgcolor ="#ffccff" >';
              echo $sum_percent_we;
              echo '</th>';
            }
          <!--[/php]-->
        <th><!--[$sum_count_they]--></th>
          <!--[php]-->
            if($sum_percent_they >=91 && $sum_percent_they <= 100){
              echo '<th width="10%" bgcolor ="#0099ff" >';
              echo $sum_percent_they;
              echo '</th>';
            }else if($sum_percent_they >=71 && $sum_percent_they < 91){
              echo '<th width="10%" bgcolor ="#33cc00" >';
              echo $sum_percent_they;
              echo '</th>';
            }else if($sum_percent_they >=51 && $sum_percent_they < 71){
              echo '<th width="10%" bgcolor ="#ffffcc" >';
              echo $sum_percent_they;
              echo '</th>';
            }else if($sum_percent_they >=1 && $sum_percent_they < 51){
              echo '<th width="10%" bgcolor ="#ff3300" >';
              echo $sum_percent_they;
              echo '</th>';
            }else if($sum_percent_they < 1){
              echo '<th width="10%" bgcolor ="#ffccff" >';
              echo $sum_percent_they;
              echo '</th>';
            }
          <!--[/php]-->
        <th><!--[$sum_all_count_unknown]--></th>
          <!--[php]-->
            if($sum_percent_all_count_unknown >=91 && $sum_percent_all_count_unknown <= 100){
              echo '<th width="10%" bgcolor ="#0099ff" >';
              echo $sum_percent_all_count_unknown;
              echo '</th>';
            }else if($sum_percent_all_count_unknown >=71 && $sum_percent_all_count_unknown < 91){
              echo '<th width="10%" bgcolor ="#33cc00" >';
              echo $sum_percent_all_count_unknown;
              echo '</th>';
            }else if($sum_percent_all_count_unknown >=51 && $sum_percent_all_count_unknown < 71){
              echo '<th width="10%" bgcolor ="#ffffcc" >';
              echo $sum_percent_all_count_unknown;
              echo '</th>';
            }else if($sum_percent_all_count_unknown >=1 && $sum_percent_all_count_unknown < 51){
              echo '<th width="10%" bgcolor ="#ff3300" >';
              echo $sum_percent_all_count_unknown;
              echo '</th>';
            }else if($sum_percent_all_count_unknown < 1){
              echo '<th width="10%" bgcolor ="#ffccff" >';
              echo $sum_percent_all_count_unknown;
              echo '</th>';
            }
          <!--[/php]-->
      </tr>
      <tr>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td></td>
        <td></td>
        <td></td>
        <td></td>
        <td></td>
        <td colspan="2">
          <table width="100%">
            <tr>
              <td bgcolor="#0099ff" width="5%">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
              <td width="95%">&nbsp;ระดับคะแนน (91% - 100%)</td> 
            </tr>
          </table>
        </td>
        <td colspan="2">
          <table width="100%">
            <tr>
              <td bgcolor="#ff3300" width="5%">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
              <td width="95%">&nbsp;ระดับคะแนน (1% - 50%)</td> 
            </tr>
          </table>
        </td>
      </tr>
      <tr>
        <td></td>
        <td></td>
        <td></td>
        <td></td>
        <td></td>
        <td colspan="2">
          <table width="100%">
            <tr>
              <td bgcolor="#33cc00" width="5%">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
              <td width="95%">&nbsp;ระดับคะแนน (71% - 90s%)</td> 
            </tr>
          </table>
        </td>
        <td colspan="2">
          <table width="100%">
            <tr>
              <td bgcolor="#ffccff" width="5%">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
              <td width="95%">&nbsp;ระดับคะแนน (0%)</td> 
            </tr>
          </table>
        </td>
      </tr>
      <tr>
        <td></td>
        <td></td>
        <td></td>
        <td></td>
        <td></td>
        <td colspan="2">
          <table width="100%">
            <tr>
              <td bgcolor="#ffffcc" width="5%">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
              <td width="95%">&nbsp;ระดับคะแนน (51% - 70%)</td> 
            </tr>
          </table>
        </td>
        <td colspan="2">
          &nbsp;
        </td>
      </tr>
    </table>
<br>

  <!--[else]-->
    Data not  found.
  <!--[/if]-->




  <!--[if $reportNMK == "nmk"]-->
  <table>
    <tr>
       <th width="100%" align="left" rowspan="5"><!--[$district_nhongmuangkhai]--></th>
    </tr>
  </table>
  <table  width="100%">
    <tr bgcolor="#99CCCC">
      <th width="10%" align="center" rowspan="2">ข้อมูล</th>
      <th width="30%" align="center" colspan="2">ผู้มีสิทธิทั้งหมด</th>
      <th width="20%" align="center" colspan="2">ประชาธิปัตย์</th>
      <th width="20%" align="center" colspan="2">เพื่อไทย</th>
      <th width="20%" align="center" colspan="2">ยังไม่ตัดสินใจ</th>
    </tr>
    <tr bgcolor="#99CCCC">
      <th width="15%" align="center">จำนวน</th>
      <th width="15%" align="center">%</th>
      <th width="10%" align="center">จำนวน</th>
      <th width="10%" align="center">%</th>
      <th width="10%" align="center">จำนวน</th>
      <th width="10%" align="center">%</th>
      <th width="10%" align="center">จำนวน</th>
      <th width="10%" align="center">%</th>
    </tr>
     <!--[foreach from=$objectNhongmuangkhaiArray item=item]-->
      <tr align="right" bgcolor="<!--[cycle values='#FFFFFF,#E8EFF7']-->">
        <td align="left"><!--[$item.name]--></td>
        <td width="15%"><!--[$item.count_nhongmuangkhai_all]--></td>
        <td width="15%">100</td>
        <td width="10%">
          <a href="<!--[pnmodurl modname='VoteDataCenter' type='remark' func='person' moo=$item.name select='we' tam_id=$tam_id]-->">
          <!--[$item.count_nhongmuangkhai_we]-->
          </a>
        </td>
          <!--[php]-->
            $item = $this->get_template_vars('item');

            $percent_count_nhongmuangkhai_we = number_format(($item['count_nhongmuangkhai_we']*100)/$item['count_nhongmuangkhai_all'], 2);

            if($percent_count_nhongmuangkhai_we >=91 && $percent_count_nhongmuangkhai_we <= 100){
              echo '<td width="10%" bgcolor ="#0099ff" >';
              echo $percent_count_nhongmuangkhai_we;
              echo '</td>';
            }else if($percent_count_nhongmuangkhai_we >=71 && $percent_count_nhongmuangkhai_we < 91){
              echo '<td width="10%" bgcolor ="#33cc00" >';
              echo $percent_count_nhongmuangkhai_we;
              echo '</td>';
            }else if($percent_count_nhongmuangkhai_we >=51 && $percent_count_nhongmuangkhai_we < 71){
              echo '<td width="10%" bgcolor ="#ffffcc" >';
              echo $percent_count_nhongmuangkhai_we;
              echo '</td>';
            }else if($percent_count_nhongmuangkhai_we >=1 && $percent_count_nhongmuangkhai_we < 51){
              echo '<td width="10%" bgcolor ="#ff3300" >';
              echo $percent_count_nhongmuangkhai_we;
              echo '</td>';
            }else if($percent_count_nhongmuangkhai_we  < 1){
              echo '<td width="10%" bgcolor ="#ffccff" >';
              echo $percent_count_nhongmuangkhai_we;
              echo '</td>';
            }
          <!--[/php]-->
        <td width="10%">
          <a href="<!--[pnmodurl modname='VoteDataCenter' type='remark' func='person' moo=$item.name select='they' tam_id=$tam_id]-->">
          <!--[$item.count_nhongmuangkhai_they]-->
          </a>
        </td>
          <!--[php]-->
            $percent_count_nhongmuangkhai_they = number_format(($item['count_nhongmuangkhai_they']*100)/$item['count_nhongmuangkhai_all'], 2);

            if($percent_count_nhongmuangkhai_they >=91 && $percent_count_nhongmuangkhai_they <= 100){
              echo '<td width="10%" bgcolor ="#0099ff" >';
              echo $percent_count_nhongmuangkhai_they;
              echo '</td>';
            }else if($percent_count_nhongmuangkhai_they >=71 && $percent_count_nhongmuangkhai_they < 91){
              echo '<td width="10%" bgcolor ="#33cc00" >';
              echo $percent_count_nhongmuangkhai_they;
              echo '</td>';
            }else if($percent_count_nhongmuangkhai_they >=51 && $percent_count_nhongmuangkhai_they < 71){
              echo '<td width="10%" bgcolor ="#ffffcc" >';
              echo $percent_count_nhongmuangkhai_they;
              echo '</td>';
            }else if($percent_count_nhongmuangkhai_they >=1 && $percent_count_nhongmuangkhai_they < 51){
              echo '<td width="10%" bgcolor ="#ff3300" >';
              echo $percent_count_nhongmuangkhai_they;
              echo '</td>';
            }else if($percent_count_nhongmuangkhai_they  < 1){
              echo '<td width="10%" bgcolor ="#ffccff" >';
              echo $percent_count_nhongmuangkhai_they;
              echo '</td>';
            }
          <!--[/php]-->
        <td width="10%">
          <a href="<!--[pnmodurl modname='VoteDataCenter' type='remark' func='person' moo=$item.name select='unknown' tam_id=$tam_id]-->">
            <!--[$item.count_nhongmuangkhai_unknown]-->
          </a>
        </td>
          <!--[php]-->
            $percent_unknown = number_format(($item['count_nhongmuangkhai_unknown']*100)/$item['count_nhongmuangkhai_all'], 2);

            if($percent_unknown >=91 && $percent_unknown <= 100){
              echo '<td width="10%" bgcolor ="#0099ff" >';
              echo $percent_unknown;
              echo '</td>';
            }else if($percent_unknown >=71 && $percent_unknown < 91){
              echo '<td width="10%" bgcolor ="#33cc00" >';
              echo $percent_unknown;
              echo '</td>';
            }else if($percent_unknown >=51 && $percent_unknown < 71){
              echo '<td width="10%" bgcolor ="#ffffcc" >';
              echo $percent_unknown;
              echo '</td>';
            }else if($percent_unknown >=1 && $percent_unknown < 51){
              echo '<td width="10%" bgcolor ="#ff3300" >';
              echo $percent_unknown;
              echo '</td>';
            }else if($percent_unknown < 1){
              echo '<td width="10%" bgcolor ="#ffccff" >';
              echo $percent_unknown;
              echo '</td>';
            }
          <!--[/php]-->
      </tr>
     <!--[/foreach]-->
      <!--[php]-->
        $sum_count_nhongmuangkhai_all = $this->get_template_vars('sum_count_nhongmuangkhai_all');
        $sum_count_nhongmuangkhai_we = $this->get_template_vars('sum_count_nhongmuangkhai_we');
        $sum_percent_we = number_format(($sum_count_nhongmuangkhai_we*100)/$sum_count_nhongmuangkhai_all, 2);

        $sum_count_nhongmuangkhai_they = $this->get_template_vars('sum_count_nhongmuangkhai_they');
        $sum_percent_they = number_format(($sum_count_nhongmuangkhai_they*100)/$sum_count_nhongmuangkhai_all, 2);

        $sum_count_nhongmuangkhai_none_canvasser = $this->get_template_vars('sum_count_nhongmuangkhai_none_canvasser');
        $sum_none_canvasser = number_format(($sum_count_nhongmuangkhai_none_canvasser*100)/$sum_count_nhongmuangkhai_all, 2);

        $sum_count_nhongmuangkhai_unknown = $this->get_template_vars('sum_count_nhongmuangkhai_unknown');
        $sum_percent_unknown = number_format((($sum_count_nhongmuangkhai_unknown*100)/$sum_count_nhongmuangkhai_all), 2, ".", ",");


        $sum_all_count_nhongmuangkhai_unknown = $this->get_template_vars('sum_all_count_nhongmuangkhai_unknown');
        $sum_percent_all_count_nhongmuangkhai_unknown = number_format((($sum_all_count_nhongmuangkhai_unknown*100)/$sum_count_nhongmuangkhai_all), 2, ".", ",");



      <!--[/php]-->
      <tr align="right" bgcolor="<!--[cycle values='#FFFFFF,#E8EFF7']-->">
        <th ><b>รวม</b></td>
        <th><!--[$sum_count_nhongmuangkhai_all]--></th>
        <th>100</th>
        <th><!--[$sum_count_nhongmuangkhai_we]--></th>
          <!--[php]-->
            if($sum_percent_we >=91 && $sum_percent_we <= 100){
              echo '<th width="10%" bgcolor ="#0099ff" >';
              echo $sum_percent_we;
              echo '</th>';
            }else if($sum_percent_we >=71 && $sum_percent_we < 91){
              echo '<th width="10%" bgcolor ="#33cc00" >';
              echo $sum_percent_we;
              echo '</th>';
            }else if($sum_percent_we >=51 && $sum_percent_we < 71){
              echo '<th width="10%" bgcolor ="#ffffcc" >';
              echo $sum_percent_we;
              echo '</th>';
            }else if($sum_percent_we >=1 && $sum_percent_we < 51){
              echo '<th width="10%" bgcolor ="#ff3300" >';
              echo $sum_percent_we;
              echo '</th>';
            }else if($sum_percent_we < 1){
              echo '<th width="10%" bgcolor ="#ffccff" >';
              echo $sum_percent_we;
              echo '</th>';
            }
          <!--[/php]-->
        <th><!--[$sum_count_nhongmuangkhai_they]--></th>
          <!--[php]-->
            if($sum_percent_they >=91 && $sum_percent_they <= 100){
              echo '<th width="10%" bgcolor ="#0099ff" >';
              echo $sum_percent_they;
              echo '</th>';
            }else if($sum_percent_they >=71 && $sum_percent_they < 91){
              echo '<th width="10%" bgcolor ="#33cc00" >';
              echo $sum_percent_they;
              echo '</th>';
            }else if($sum_percent_they >=51 && $sum_percent_they < 71){
              echo '<th width="10%" bgcolor ="#ffffcc" >';
              echo $sum_percent_they;
              echo '</th>';
            }else if($sum_percent_they >=1 && $sum_percent_they < 51){
              echo '<th width="10%" bgcolor ="#ff3300" >';
              echo $sum_percent_they;
              echo '</th>';
            }else if($sum_percent_they < 1){
              echo '<th width="10%" bgcolor ="#ffccff" >';
              echo $sum_percent_they;
              echo '</th>';
            }
          <!--[/php]-->
        <th><!--[$sum_all_count_nhongmuangkhai_unknown]--></th>
          <!--[php]-->
            if($sum_percent_all_count_nhongmuangkhai_unknown >=91 && $sum_percent_all_count_nhongmuangkhai_unknown <= 100){
              echo '<th width="10%" bgcolor ="#0099ff" >';
              echo $sum_percent_all_count_nhongmuangkhai_unknown;
              echo '</th>';
            }else if($sum_percent_all_count_nhongmuangkhai_unknown >=71 && $sum_percent_all_count_nhongmuangkhai_unknown < 91){
              echo '<th width="10%" bgcolor ="#33cc00" >';
              echo $sum_percent_all_count_nhongmuangkhai_unknown;
              echo '</th>';
            }else if($sum_percent_all_count_nhongmuangkhai_unknown >=51 && $sum_percent_all_count_nhongmuangkhai_unknown < 71){
              echo '<th width="10%" bgcolor ="#ffffcc" >';
              echo $sum_percent_all_count_nhongmuangkhai_unknown;
              echo '</th>';
            }else if($sum_percent_all_count_nhongmuangkhai_unknown >=1 && $sum_percent_all_count_nhongmuangkhai_unknown < 51){
              echo '<th width="10%" bgcolor ="#ff3300" >';
              echo $sum_percent_all_count_nhongmuangkhai_unknown;
              echo '</th>';
            }else if($sum_percent_all_count_nhongmuangkhai_unknown < 1){
              echo '<th width="10%" bgcolor ="#ffccff" >';
              echo $sum_percent_all_count_nhongmuangkhai_unknown;
              echo '</th>';
            }
          <!--[/php]-->
      </tr>
      <tr>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td></td>
        <td></td>
        <td></td>
        <td></td>
        <td></td>
        <td colspan="2">
          <table width="100%">
            <tr>
              <td bgcolor="#0099ff" width="5%">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
              <td width="95%">&nbsp;ระดับคะแนน (91% - 100%)</td> 
            </tr>
          </table>
        </td>
        <td colspan="2">
          <table width="100%">
            <tr>
              <td bgcolor="#ff3300" width="5%">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
              <td width="95%">&nbsp;ระดับคะแนน (1% - 50%)</td> 
            </tr>
          </table>
        </td>
      </tr>
      <tr>
        <td></td>
        <td></td>
        <td></td>
        <td></td>
        <td></td>
        <td colspan="2">
          <table width="100%">
            <tr>
              <td bgcolor="#33cc00" width="5%">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
              <td width="95%">&nbsp;ระดับคะแนน (71% - 90s%)</td> 
            </tr>
          </table>
        </td>
        <td colspan="2">
          <table width="100%">
            <tr>
              <td bgcolor="#ffccff" width="5%">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
              <td width="95%">&nbsp;ระดับคะแนน (0%)</td> 
            </tr>
          </table>
        </td>
      </tr>
      <tr>
        <td></td>
        <td></td>
        <td></td>
        <td></td>
        <td></td>
        <td colspan="2">
          <table width="100%">
            <tr>
              <td bgcolor="#ffffcc" width="5%">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
              <td width="95%">&nbsp;ระดับคะแนน (51% - 70%)</td> 
            </tr>
          </table>
        </td>
        <td colspan="2">
          &nbsp;
        </td>
      </tr>
    </table>
<br>

  <!--[/if]-->


  <!--[if $reportSong == "song"]-->
  <table>
    <tr>
       <th width="100%" align="left" rowspan="5"><!--[$district_song]--></th>
    </tr>
  </table>
  <table  width="100%">
    <tr bgcolor="#99CCCC">
      <th width="10%" align="center" rowspan="2">ข้อมูล</th>
      <th width="30%" align="center" colspan="2">ผู้มีสิทธิทั้งหมด</th>
      <th width="20%" align="center" colspan="2">ประชาธิปัตย์</th>
      <th width="20%" align="center" colspan="2">เพื่อไทย</th>
      <th width="20%" align="center" colspan="2">ยังไม่ตัดสินใจ</th>
    </tr>
    <tr bgcolor="#99CCCC">
      <th width="15%" align="center">จำนวน</th>
      <th width="15%" align="center">%</th>
      <th width="10%" align="center">จำนวน</th>
      <th width="10%" align="center">%</th>
      <th width="10%" align="center">จำนวน</th>
      <th width="10%" align="center">%</th>
      <th width="10%" align="center">จำนวน</th>
      <th width="10%" align="center">%</th>
    </tr>
     <!--[foreach from=$objectSongArray item=item]-->
      <tr align="right" bgcolor="<!--[cycle values='#FFFFFF,#E8EFF7']-->">
        <td align="left"><!--[$item.name]--></td>
        <td width="15%"><!--[$item.count_song_all]--></td>
        <td width="15%">100</td>
        <td width="10%">
          <a href="<!--[pnmodurl modname='VoteDataCenter' type='remark' func='person' moo=$item.name select='we' tam_id=$tam_id]-->">
          <!--[$item.count_song_we]-->
          </a>
        </td>
          <!--[php]-->
            $item = $this->get_template_vars('item');

            $percent_count_song_we = number_format(($item['count_song_we']*100)/$item['count_song_all'], 2);

            if($percent_count_song_we >=91 && $percent_count_song_we <= 100){
              echo '<td width="10%" bgcolor ="#0099ff" >';
              echo $percent_count_song_we;
              echo '</td>';
            }else if($percent_count_song_we >=71 && $percent_count_song_we < 91){
              echo '<td width="10%" bgcolor ="#33cc00" >';
              echo $percent_count_song_we;
              echo '</td>';
            }else if($percent_count_song_we >=51 && $percent_count_song_we < 71){
              echo '<td width="10%" bgcolor ="#ffffcc" >';
              echo $percent_count_song_we;
              echo '</td>';
            }else if($percent_count_song_we >=1 && $percent_count_song_we < 51){
              echo '<td width="10%" bgcolor ="#ff3300" >';
              echo $percent_count_song_we;
              echo '</td>';
            }else if($percent_count_song_we  < 1){
              echo '<td width="10%" bgcolor ="#ffccff" >';
              echo $percent_count_song_we;
              echo '</td>';
            }
          <!--[/php]-->
        <td width="10%">
          <a href="<!--[pnmodurl modname='VoteDataCenter' type='remark' func='person' moo=$item.name select='they' tam_id=$tam_id]-->">
          <!--[$item.count_song_they]-->
          </a>
        </td>
          <!--[php]-->
            $percent_count_song_they = number_format(($item['count_song_they']*100)/$item['count_song_all'], 2);

            if($percent_count_song_they >=91 && $percent_count_song_they <= 100){
              echo '<td width="10%" bgcolor ="#0099ff" >';
              echo $percent_count_song_they;
              echo '</td>';
            }else if($percent_count_song_they >=71 && $percent_count_song_they < 91){
              echo '<td width="10%" bgcolor ="#33cc00" >';
              echo $percent_count_song_they;
              echo '</td>';
            }else if($percent_count_song_they >=51 && $percent_count_song_they < 71){
              echo '<td width="10%" bgcolor ="#ffffcc" >';
              echo $percent_count_song_they;
              echo '</td>';
            }else if($percent_count_song_they >=1 && $percent_count_song_they < 51){
              echo '<td width="10%" bgcolor ="#ff3300" >';
              echo $percent_count_song_they;
              echo '</td>';
            }else if($percent_count_song_they  < 1){
              echo '<td width="10%" bgcolor ="#ffccff" >';
              echo $percent_count_song_they;
              echo '</td>';
            }
          <!--[/php]-->
        <td width="10%">
          <a href="<!--[pnmodurl modname='VoteDataCenter' type='remark' func='person' moo=$item.name select='unknown' tam_id=$tam_id]-->">
            <!--[$item.count_song_unknown]-->
          </a>
        </td>
          <!--[php]-->
            $percent_unknown = number_format(($item['count_song_unknown']*100)/$item['count_song_all'], 2);

            if($percent_unknown >=91 && $percent_unknown <= 100){
              echo '<td width="10%" bgcolor ="#0099ff" >';
              echo $percent_unknown;
              echo '</td>';
            }else if($percent_unknown >=71 && $percent_unknown < 91){
              echo '<td width="10%" bgcolor ="#33cc00" >';
              echo $percent_unknown;
              echo '</td>';
            }else if($percent_unknown >=51 && $percent_unknown < 71){
              echo '<td width="10%" bgcolor ="#ffffcc" >';
              echo $percent_unknown;
              echo '</td>';
            }else if($percent_unknown >=1 && $percent_unknown < 51){
              echo '<td width="10%" bgcolor ="#ff3300" >';
              echo $percent_unknown;
              echo '</td>';
            }else if($percent_unknown < 1){
              echo '<td width="10%" bgcolor ="#ffccff" >';
              echo $percent_unknown;
              echo '</td>';
            }
          <!--[/php]-->
      </tr>
     <!--[/foreach]-->
      <!--[php]-->
        $sum_count_song_all = $this->get_template_vars('sum_count_song_all');
        $sum_count_song_we = $this->get_template_vars('sum_count_song_we');
        $sum_percent_we = number_format(($sum_count_song_we*100)/$sum_count_song_all, 2);

        $sum_count_song_they = $this->get_template_vars('sum_count_song_they');
        $sum_percent_they = number_format(($sum_count_song_they*100)/$sum_count_song_all, 2);

        $sum_count_song_none_canvasser = $this->get_template_vars('sum_count_song_none_canvasser');
        $sum_none_canvasser = number_format(($sum_count_song_none_canvasser*100)/$sum_count_song_all, 2);

        $sum_count_song_unknown = $this->get_template_vars('sum_count_song_unknown');
        $sum_percent_unknown = number_format((($sum_count_song_unknown*100)/$sum_count_song_all), 2, ".", ",");


        $sum_all_count_song_unknown = $this->get_template_vars('sum_all_count_song_unknown');
        $sum_percent_all_count_song_unknown = number_format((($sum_all_count_song_unknown*100)/$sum_count_song_all), 2, ".", ",");



      <!--[/php]-->
      <tr align="right" bgcolor="<!--[cycle values='#FFFFFF,#E8EFF7']-->">
        <th ><b>รวม</b></td>
        <th><!--[$sum_count_song_all]--></th>
        <th>100</th>
        <th><!--[$sum_count_song_we]--></th>
          <!--[php]-->
            if($sum_percent_we >=91 && $sum_percent_we <= 100){
              echo '<th width="10%" bgcolor ="#0099ff" >';
              echo $sum_percent_we;
              echo '</th>';
            }else if($sum_percent_we >=71 && $sum_percent_we < 91){
              echo '<th width="10%" bgcolor ="#33cc00" >';
              echo $sum_percent_we;
              echo '</th>';
            }else if($sum_percent_we >=51 && $sum_percent_we < 71){
              echo '<th width="10%" bgcolor ="#ffffcc" >';
              echo $sum_percent_we;
              echo '</th>';
            }else if($sum_percent_we >=1 && $sum_percent_we < 51){
              echo '<th width="10%" bgcolor ="#ff3300" >';
              echo $sum_percent_we;
              echo '</th>';
            }else if($sum_percent_we < 1){
              echo '<th width="10%" bgcolor ="#ffccff" >';
              echo $sum_percent_we;
              echo '</th>';
            }
          <!--[/php]-->
        <th><!--[$sum_count_song_they]--></th>
          <!--[php]-->
            if($sum_percent_they >=91 && $sum_percent_they <= 100){
              echo '<th width="10%" bgcolor ="#0099ff" >';
              echo $sum_percent_they;
              echo '</th>';
            }else if($sum_percent_they >=71 && $sum_percent_they < 91){
              echo '<th width="10%" bgcolor ="#33cc00" >';
              echo $sum_percent_they;
              echo '</th>';
            }else if($sum_percent_they >=51 && $sum_percent_they < 71){
              echo '<th width="10%" bgcolor ="#ffffcc" >';
              echo $sum_percent_they;
              echo '</th>';
            }else if($sum_percent_they >=1 && $sum_percent_they < 51){
              echo '<th width="10%" bgcolor ="#ff3300" >';
              echo $sum_percent_they;
              echo '</th>';
            }else if($sum_percent_they < 1){
              echo '<th width="10%" bgcolor ="#ffccff" >';
              echo $sum_percent_they;
              echo '</th>';
            }
          <!--[/php]-->
        <th><!--[$sum_all_count_song_unknown]--></th>
          <!--[php]-->
            if($sum_percent_all_count_song_unknown >=91 && $sum_percent_all_count_song_unknown <= 100){
              echo '<th width="10%" bgcolor ="#0099ff" >';
              echo $sum_percent_all_count_song_unknown;
              echo '</th>';
            }else if($sum_percent_all_count_song_unknown >=71 && $sum_percent_all_count_song_unknown < 91){
              echo '<th width="10%" bgcolor ="#33cc00" >';
              echo $sum_percent_all_count_song_unknown;
              echo '</th>';
            }else if($sum_percent_all_count_song_unknown >=51 && $sum_percent_all_count_song_unknown < 71){
              echo '<th width="10%" bgcolor ="#ffffcc" >';
              echo $sum_percent_all_count_song_unknown;
              echo '</th>';
            }else if($sum_percent_all_count_song_unknown >=1 && $sum_percent_all_count_song_unknown < 51){
              echo '<th width="10%" bgcolor ="#ff3300" >';
              echo $sum_percent_all_count_song_unknown;
              echo '</th>';
            }else if($sum_percent_all_count_song_unknown < 1){
              echo '<th width="10%" bgcolor ="#ffccff" >';
              echo $sum_percent_all_count_song_unknown;
              echo '</th>';
            }
          <!--[/php]-->
      </tr>
      <tr>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td></td>
        <td></td>
        <td></td>
        <td></td>
        <td></td>
        <td colspan="2">
          <table width="100%">
            <tr>
              <td bgcolor="#0099ff" width="5%">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
              <td width="95%">&nbsp;ระดับคะแนน (91% - 100%)</td> 
            </tr>
          </table>
        </td>
        <td colspan="2">
          <table width="100%">
            <tr>
              <td bgcolor="#ff3300" width="5%">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
              <td width="95%">&nbsp;ระดับคะแนน (1% - 50%)</td> 
            </tr>
          </table>
        </td>
      </tr>
      <tr>
        <td></td>
        <td></td>
        <td></td>
        <td></td>
        <td></td>
        <td colspan="2">
          <table width="100%">
            <tr>
              <td bgcolor="#33cc00" width="5%">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
              <td width="95%">&nbsp;ระดับคะแนน (71% - 90s%)</td> 
            </tr>
          </table>
        </td>
        <td colspan="2">
          <table width="100%">
            <tr>
              <td bgcolor="#ffccff" width="5%">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
              <td width="95%">&nbsp;ระดับคะแนน (0%)</td> 
            </tr>
          </table>
        </td>
      </tr>
      <tr>
        <td></td>
        <td></td>
        <td></td>
        <td></td>
        <td></td>
        <td colspan="2">
          <table width="100%">
            <tr>
              <td bgcolor="#ffffcc" width="5%">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
              <td width="95%">&nbsp;ระดับคะแนน (51% - 70%)</td> 
            </tr>
          </table>
        </td>
        <td colspan="2">
          &nbsp;
        </td>
      </tr>
    </table>
<br>
  <!--[/if]-->






  <!--[if $reportRongkwang == "rongkwang"]-->
  <table>
    <tr>
       <th width="100%" align="left" rowspan="5"><!--[$district_rongkwang]--></th>
    </tr>
  </table>
  <table  width="100%">
    <tr bgcolor="#99CCCC">
      <th width="10%" align="center" rowspan="2">ข้อมูล</th>
      <th width="30%" align="center" colspan="2">ผู้มีสิทธิทั้งหมด</th>
      <th width="20%" align="center" colspan="2">ประชาธิปัตย์</th>
      <th width="20%" align="center" colspan="2">เพื่อไทย</th>
      <th width="20%" align="center" colspan="2">ยังไม่ตัดสินใจ</th>
    </tr>
    <tr bgcolor="#99CCCC">
      <th width="15%" align="center">จำนวน</th>
      <th width="15%" align="center">%</th>
      <th width="10%" align="center">จำนวน</th>
      <th width="10%" align="center">%</th>
      <th width="10%" align="center">จำนวน</th>
      <th width="10%" align="center">%</th>
      <th width="10%" align="center">จำนวน</th>
      <th width="10%" align="center">%</th>
    </tr>
     <!--[foreach from=$objectRongkwangArray item=item]-->
      <tr align="right" bgcolor="<!--[cycle values='#FFFFFF,#E8EFF7']-->">
        <td align="left"><!--[$item.name]--></td>
        <td width="15%"><!--[$item.count_rongkwang_all]--></td>
        <td width="15%">100</td>
        <td width="10%">
          <a href="<!--[pnmodurl modname='VoteDataCenter' type='remark' func='person' moo=$item.name select='we' tam_id=$tam_id]-->">
          <!--[$item.count_rongkwang_we]-->
          </a>
        </td>
          <!--[php]-->
            $item = $this->get_template_vars('item');

            $percent_count_rongkwang_we = number_format(($item['count_rongkwang_we']*100)/$item['count_rongkwang_all'], 2);

            if($percent_count_rongkwang_we >=91 && $percent_count_rongkwang_we <= 100){
              echo '<td width="10%" bgcolor ="#0099ff" >';
              echo $percent_count_rongkwang_we;
              echo '</td>';
            }else if($percent_count_rongkwang_we >=71 && $percent_count_rongkwang_we < 91){
              echo '<td width="10%" bgcolor ="#33cc00" >';
              echo $percent_count_rongkwang_we;
              echo '</td>';
            }else if($percent_count_rongkwang_we >=51 && $percent_count_rongkwang_we < 71){
              echo '<td width="10%" bgcolor ="#ffffcc" >';
              echo $percent_count_rongkwang_we;
              echo '</td>';
            }else if($percent_count_rongkwang_we >=1 && $percent_count_rongkwang_we < 51){
              echo '<td width="10%" bgcolor ="#ff3300" >';
              echo $percent_count_rongkwang_we;
              echo '</td>';
            }else if($percent_count_rongkwang_we  < 1){
              echo '<td width="10%" bgcolor ="#ffccff" >';
              echo $percent_count_rongkwang_we;
              echo '</td>';
            }
          <!--[/php]-->
        <td width="10%">
          <a href="<!--[pnmodurl modname='VoteDataCenter' type='remark' func='person' moo=$item.name select='they' tam_id=$tam_id]-->">
          <!--[$item.count_rongkwang_they]-->
          </a>
        </td>
          <!--[php]-->
            $percent_count_rongkwang_they = number_format(($item['count_rongkwang_they']*100)/$item['count_rongkwang_all'], 2);

            if($percent_count_rongkwang_they >=91 && $percent_count_rongkwang_they <= 100){
              echo '<td width="10%" bgcolor ="#0099ff" >';
              echo $percent_count_rongkwang_they;
              echo '</td>';
            }else if($percent_count_rongkwang_they >=71 && $percent_count_rongkwang_they < 91){
              echo '<td width="10%" bgcolor ="#33cc00" >';
              echo $percent_count_rongkwang_they;
              echo '</td>';
            }else if($percent_count_rongkwang_they >=51 && $percent_count_rongkwang_they < 71){
              echo '<td width="10%" bgcolor ="#ffffcc" >';
              echo $percent_count_rongkwang_they;
              echo '</td>';
            }else if($percent_count_rongkwang_they >=1 && $percent_count_rongkwang_they < 51){
              echo '<td width="10%" bgcolor ="#ff3300" >';
              echo $percent_count_rongkwang_they;
              echo '</td>';
            }else if($percent_count_rongkwang_they  < 1){
              echo '<td width="10%" bgcolor ="#ffccff" >';
              echo $percent_count_rongkwang_they;
              echo '</td>';
            }
          <!--[/php]-->
        <td width="10%">
          <a href="<!--[pnmodurl modname='VoteDataCenter' type='remark' func='person' moo=$item.name select='unknown' tam_id=$tam_id]-->">
            <!--[$item.count_rongkwang_unknown]-->
          </a>
        </td>
          <!--[php]-->
            $percent_unknown = number_format(($item['count_rongkwang_unknown']*100)/$item['count_rongkwang_all'], 2);

            if($percent_unknown >=91 && $percent_unknown <= 100){
              echo '<td width="10%" bgcolor ="#0099ff" >';
              echo $percent_unknown;
              echo '</td>';
            }else if($percent_unknown >=71 && $percent_unknown < 91){
              echo '<td width="10%" bgcolor ="#33cc00" >';
              echo $percent_unknown;
              echo '</td>';
            }else if($percent_unknown >=51 && $percent_unknown < 71){
              echo '<td width="10%" bgcolor ="#ffffcc" >';
              echo $percent_unknown;
              echo '</td>';
            }else if($percent_unknown >=1 && $percent_unknown < 51){
              echo '<td width="10%" bgcolor ="#ff3300" >';
              echo $percent_unknown;
              echo '</td>';
            }else if($percent_unknown < 1){
              echo '<td width="10%" bgcolor ="#ffccff" >';
              echo $percent_unknown;
              echo '</td>';
            }
          <!--[/php]-->
      </tr>
     <!--[/foreach]-->
      <!--[php]-->
        $sum_count_rongkwang_all = $this->get_template_vars('sum_count_rongkwang_all');
        $sum_count_rongkwang_we = $this->get_template_vars('sum_count_rongkwang_we');
        $sum_percent_we = number_format(($sum_count_rongkwang_we*100)/$sum_count_rongkwang_all, 2);

        $sum_count_rongkwang_they = $this->get_template_vars('sum_count_rongkwang_they');
        $sum_percent_they = number_format(($sum_count_rongkwang_they*100)/$sum_count_rongkwang_all, 2);

        $sum_count_rongkwang_none_canvasser = $this->get_template_vars('sum_count_rongkwang_none_canvasser');
        $sum_none_canvasser = number_format(($sum_count_rongkwang_none_canvasser*100)/$sum_count_rongkwang_all, 2);

        $sum_count_rongkwang_unknown = $this->get_template_vars('sum_count_rongkwang_unknown');
        $sum_percent_unknown = number_format((($sum_count_rongkwang_unknown*100)/$sum_count_rongkwang_all), 2, ".", ",");


        $sum_all_count_rongkwang_unknown = $this->get_template_vars('sum_all_count_rongkwang_unknown');
        $sum_percent_all_count_rongkwang_unknown = number_format((($sum_all_count_rongkwang_unknown*100)/$sum_count_rongkwang_all), 2, ".", ",");



      <!--[/php]-->
      <tr align="right" bgcolor="<!--[cycle values='#FFFFFF,#E8EFF7']-->">
        <th ><b>รวม</b></td>
        <th><!--[$sum_count_rongkwang_all]--></th>
        <th>100</th>
        <th><!--[$sum_count_rongkwang_we]--></th>
          <!--[php]-->
            if($sum_percent_we >=91 && $sum_percent_we <= 100){
              echo '<th width="10%" bgcolor ="#0099ff" >';
              echo $sum_percent_we;
              echo '</th>';
            }else if($sum_percent_we >=71 && $sum_percent_we < 91){
              echo '<th width="10%" bgcolor ="#33cc00" >';
              echo $sum_percent_we;
              echo '</th>';
            }else if($sum_percent_we >=51 && $sum_percent_we < 71){
              echo '<th width="10%" bgcolor ="#ffffcc" >';
              echo $sum_percent_we;
              echo '</th>';
            }else if($sum_percent_we >=1 && $sum_percent_we < 51){
              echo '<th width="10%" bgcolor ="#ff3300" >';
              echo $sum_percent_we;
              echo '</th>';
            }else if($sum_percent_we < 1){
              echo '<th width="10%" bgcolor ="#ffccff" >';
              echo $sum_percent_we;
              echo '</th>';
            }
          <!--[/php]-->
        <th><!--[$sum_count_rongkwang_they]--></th>
          <!--[php]-->
            if($sum_percent_they >=91 && $sum_percent_they <= 100){
              echo '<th width="10%" bgcolor ="#0099ff" >';
              echo $sum_percent_they;
              echo '</th>';
            }else if($sum_percent_they >=71 && $sum_percent_they < 91){
              echo '<th width="10%" bgcolor ="#33cc00" >';
              echo $sum_percent_they;
              echo '</th>';
            }else if($sum_percent_they >=51 && $sum_percent_they < 71){
              echo '<th width="10%" bgcolor ="#ffffcc" >';
              echo $sum_percent_they;
              echo '</th>';
            }else if($sum_percent_they >=1 && $sum_percent_they < 51){
              echo '<th width="10%" bgcolor ="#ff3300" >';
              echo $sum_percent_they;
              echo '</th>';
            }else if($sum_percent_they < 1){
              echo '<th width="10%" bgcolor ="#ffccff" >';
              echo $sum_percent_they;
              echo '</th>';
            }
          <!--[/php]-->
        <th><!--[$sum_all_count_rongkwang_unknown]--></th>
          <!--[php]-->
            if($sum_percent_all_count_rongkwang_unknown >=91 && $sum_percent_all_count_rongkwang_unknown <= 100){
              echo '<th width="10%" bgcolor ="#0099ff" >';
              echo $sum_percent_all_count_rongkwang_unknown;
              echo '</th>';
            }else if($sum_percent_all_count_rongkwang_unknown >=71 && $sum_percent_all_count_rongkwang_unknown < 91){
              echo '<th width="10%" bgcolor ="#33cc00" >';
              echo $sum_percent_all_count_rongkwang_unknown;
              echo '</th>';
            }else if($sum_percent_all_count_rongkwang_unknown >=51 && $sum_percent_all_count_rongkwang_unknown < 71){
              echo '<th width="10%" bgcolor ="#ffffcc" >';
              echo $sum_percent_all_count_rongkwang_unknown;
              echo '</th>';
            }else if($sum_percent_all_count_rongkwang_unknown >=1 && $sum_percent_all_count_rongkwang_unknown < 51){
              echo '<th width="10%" bgcolor ="#ff3300" >';
              echo $sum_percent_all_count_rongkwang_unknown;
              echo '</th>';
            }else if($sum_percent_all_count_rongkwang_unknown < 1){
              echo '<th width="10%" bgcolor ="#ffccff" >';
              echo $sum_percent_all_count_rongkwang_unknown;
              echo '</th>';
            }
          <!--[/php]-->
      </tr>
      <tr>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td></td>
        <td></td>
        <td></td>
        <td></td>
        <td></td>
        <td colspan="2">
          <table width="100%">
            <tr>
              <td bgcolor="#0099ff" width="5%">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
              <td width="95%">&nbsp;ระดับคะแนน (91% - 100%)</td> 
            </tr>
          </table>
        </td>
        <td colspan="2">
          <table width="100%">
            <tr>
              <td bgcolor="#ff3300" width="5%">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
              <td width="95%">&nbsp;ระดับคะแนน (1% - 50%)</td> 
            </tr>
          </table>
        </td>
      </tr>
      <tr>
        <td></td>
        <td></td>
        <td></td>
        <td></td>
        <td></td>
        <td colspan="2">
          <table width="100%">
            <tr>
              <td bgcolor="#33cc00" width="5%">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
              <td width="95%">&nbsp;ระดับคะแนน (71% - 90s%)</td> 
            </tr>
          </table>
        </td>
        <td colspan="2">
          <table width="100%">
            <tr>
              <td bgcolor="#ffccff" width="5%">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
              <td width="95%">&nbsp;ระดับคะแนน (0%)</td> 
            </tr>
          </table>
        </td>
      </tr>
      <tr>
        <td></td>
        <td></td>
        <td></td>
        <td></td>
        <td></td>
        <td colspan="2">
          <table width="100%">
            <tr>
              <td bgcolor="#ffffcc" width="5%">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
              <td width="95%">&nbsp;ระดับคะแนน (51% - 70%)</td> 
            </tr>
          </table>
        </td>
        <td colspan="2">
          &nbsp;
        </td>
      </tr>
    </table>
<br>
  <!--[/if]-->







  <!--[if $reportSungmen == "sungmen"]-->
  <table>
    <tr>
       <th width="100%" align="left" rowspan="5"><!--[$district_sungmen]--></th>
    </tr>
  </table>
  <table  width="100%">
    <tr bgcolor="#99CCCC">
      <th width="10%" align="center" rowspan="2">ข้อมูล</th>
      <th width="30%" align="center" colspan="2">ผู้มีสิทธิทั้งหมด</th>
      <th width="20%" align="center" colspan="2">ประชาธิปัตย์</th>
      <th width="20%" align="center" colspan="2">เพื่อไทย</th>
      <th width="20%" align="center" colspan="2">ยังไม่ตัดสินใจ</th>
    </tr>
    <tr bgcolor="#99CCCC">
      <th width="15%" align="center">จำนวน</th>
      <th width="15%" align="center">%</th>
      <th width="10%" align="center">จำนวน</th>
      <th width="10%" align="center">%</th>
      <th width="10%" align="center">จำนวน</th>
      <th width="10%" align="center">%</th>
      <th width="10%" align="center">จำนวน</th>
      <th width="10%" align="center">%</th>
    </tr>
     <!--[foreach from=$objectSungmenArray item=item]-->
      <tr align="right" bgcolor="<!--[cycle values='#FFFFFF,#E8EFF7']-->">
        <td align="left"><!--[$item.name]--></td>
        <td width="15%"><!--[$item.count_sungmen_all]--></td>
        <td width="15%">100</td>
        <td width="10%">
          <a href="<!--[pnmodurl modname='VoteDataCenter' type='remark' func='person' moo=$item.name select='we' tam_id=$tam_id]-->">
          <!--[$item.count_sungmen_we]-->
          </a>
        </td>
          <!--[php]-->
            $item = $this->get_template_vars('item');

            $percent_count_sungmen_we = number_format(($item['count_sungmen_we']*100)/$item['count_sungmen_all'], 2);

            if($percent_count_sungmen_we >=91 && $percent_count_sungmen_we <= 100){
              echo '<td width="10%" bgcolor ="#0099ff" >';
              echo $percent_count_sungmen_we;
              echo '</td>';
            }else if($percent_count_sungmen_we >=71 && $percent_count_sungmen_we < 91){
              echo '<td width="10%" bgcolor ="#33cc00" >';
              echo $percent_count_sungmen_we;
              echo '</td>';
            }else if($percent_count_sungmen_we >=51 && $percent_count_sungmen_we < 71){
              echo '<td width="10%" bgcolor ="#ffffcc" >';
              echo $percent_count_sungmen_we;
              echo '</td>';
            }else if($percent_count_sungmen_we >=1 && $percent_count_sungmen_we < 51){
              echo '<td width="10%" bgcolor ="#ff3300" >';
              echo $percent_count_sungmen_we;
              echo '</td>';
            }else if($percent_count_sungmen_we  < 1){
              echo '<td width="10%" bgcolor ="#ffccff" >';
              echo $percent_count_sungmen_we;
              echo '</td>';
            }
          <!--[/php]-->
        <td width="10%">
          <a href="<!--[pnmodurl modname='VoteDataCenter' type='remark' func='person' moo=$item.name select='they' tam_id=$tam_id]-->">
          <!--[$item.count_sungmen_they]-->
          </a>
        </td>
          <!--[php]-->
            $percent_count_sungmen_they = number_format(($item['count_sungmen_they']*100)/$item['count_sungmen_all'], 2);

            if($percent_count_sungmen_they >=91 && $percent_count_sungmen_they <= 100){
              echo '<td width="10%" bgcolor ="#0099ff" >';
              echo $percent_count_sungmen_they;
              echo '</td>';
            }else if($percent_count_sungmen_they >=71 && $percent_count_sungmen_they < 91){
              echo '<td width="10%" bgcolor ="#33cc00" >';
              echo $percent_count_sungmen_they;
              echo '</td>';
            }else if($percent_count_sungmen_they >=51 && $percent_count_sungmen_they < 71){
              echo '<td width="10%" bgcolor ="#ffffcc" >';
              echo $percent_count_sungmen_they;
              echo '</td>';
            }else if($percent_count_sungmen_they >=1 && $percent_count_sungmen_they < 51){
              echo '<td width="10%" bgcolor ="#ff3300" >';
              echo $percent_count_sungmen_they;
              echo '</td>';
            }else if($percent_count_sungmen_they  < 1){
              echo '<td width="10%" bgcolor ="#ffccff" >';
              echo $percent_count_sungmen_they;
              echo '</td>';
            }
          <!--[/php]-->
        <td width="10%">
          <a href="<!--[pnmodurl modname='VoteDataCenter' type='remark' func='person' moo=$item.name select='unknown' tam_id=$tam_id]-->">
            <!--[$item.count_sungmen_unknown]-->
          </a>
        </td>
          <!--[php]-->
            $percent_unknown = number_format(($item['count_sungmen_unknown']*100)/$item['count_sungmen_all'], 2);

            if($percent_unknown >=91 && $percent_unknown <= 100){
              echo '<td width="10%" bgcolor ="#0099ff" >';
              echo $percent_unknown;
              echo '</td>';
            }else if($percent_unknown >=71 && $percent_unknown < 91){
              echo '<td width="10%" bgcolor ="#33cc00" >';
              echo $percent_unknown;
              echo '</td>';
            }else if($percent_unknown >=51 && $percent_unknown < 71){
              echo '<td width="10%" bgcolor ="#ffffcc" >';
              echo $percent_unknown;
              echo '</td>';
            }else if($percent_unknown >=1 && $percent_unknown < 51){
              echo '<td width="10%" bgcolor ="#ff3300" >';
              echo $percent_unknown;
              echo '</td>';
            }else if($percent_unknown < 1){
              echo '<td width="10%" bgcolor ="#ffccff" >';
              echo $percent_unknown;
              echo '</td>';
            }
          <!--[/php]-->
      </tr>
     <!--[/foreach]-->
      <!--[php]-->
        $sum_count_sungmen_all = $this->get_template_vars('sum_count_sungmen_all');
        $sum_count_sungmen_we = $this->get_template_vars('sum_count_sungmen_we');
        $sum_percent_we = number_format(($sum_count_sungmen_we*100)/$sum_count_sungmen_all, 2);

        $sum_count_sungmen_they = $this->get_template_vars('sum_count_sungmen_they');
        $sum_percent_they = number_format(($sum_count_sungmen_they*100)/$sum_count_sungmen_all, 2);

        $sum_count_sungmen_none_canvasser = $this->get_template_vars('sum_count_sungmen_none_canvasser');
        $sum_none_canvasser = number_format(($sum_count_sungmen_none_canvasser*100)/$sum_count_sungmen_all, 2);

        $sum_count_sungmen_unknown = $this->get_template_vars('sum_count_sungmen_unknown');
        $sum_percent_unknown = number_format((($sum_count_sungmen_unknown*100)/$sum_count_sungmen_all), 2, ".", ",");


        $sum_all_count_sungmen_unknown = $this->get_template_vars('sum_all_count_sungmen_unknown');
        $sum_percent_all_count_sungmen_unknown = number_format((($sum_all_count_sungmen_unknown*100)/$sum_count_sungmen_all), 2, ".", ",");



      <!--[/php]-->
      <tr align="right" bgcolor="<!--[cycle values='#FFFFFF,#E8EFF7']-->">
        <th ><b>รวม</b></td>
        <th><!--[$sum_count_sungmen_all]--></th>
        <th>100</th>
        <th><!--[$sum_count_sungmen_we]--></th>
          <!--[php]-->
            if($sum_percent_we >=91 && $sum_percent_we <= 100){
              echo '<th width="10%" bgcolor ="#0099ff" >';
              echo $sum_percent_we;
              echo '</th>';
            }else if($sum_percent_we >=71 && $sum_percent_we < 91){
              echo '<th width="10%" bgcolor ="#33cc00" >';
              echo $sum_percent_we;
              echo '</th>';
            }else if($sum_percent_we >=51 && $sum_percent_we < 71){
              echo '<th width="10%" bgcolor ="#ffffcc" >';
              echo $sum_percent_we;
              echo '</th>';
            }else if($sum_percent_we >=1 && $sum_percent_we < 51){
              echo '<th width="10%" bgcolor ="#ff3300" >';
              echo $sum_percent_we;
              echo '</th>';
            }else if($sum_percent_we < 1){
              echo '<th width="10%" bgcolor ="#ffccff" >';
              echo $sum_percent_we;
              echo '</th>';
            }
          <!--[/php]-->
        <th><!--[$sum_count_sungmen_they]--></th>
          <!--[php]-->
            if($sum_percent_they >=91 && $sum_percent_they <= 100){
              echo '<th width="10%" bgcolor ="#0099ff" >';
              echo $sum_percent_they;
              echo '</th>';
            }else if($sum_percent_they >=71 && $sum_percent_they < 91){
              echo '<th width="10%" bgcolor ="#33cc00" >';
              echo $sum_percent_they;
              echo '</th>';
            }else if($sum_percent_they >=51 && $sum_percent_they < 71){
              echo '<th width="10%" bgcolor ="#ffffcc" >';
              echo $sum_percent_they;
              echo '</th>';
            }else if($sum_percent_they >=1 && $sum_percent_they < 51){
              echo '<th width="10%" bgcolor ="#ff3300" >';
              echo $sum_percent_they;
              echo '</th>';
            }else if($sum_percent_they < 1){
              echo '<th width="10%" bgcolor ="#ffccff" >';
              echo $sum_percent_they;
              echo '</th>';
            }
          <!--[/php]-->
        <th><!--[$sum_all_count_sungmen_unknown]--></th>
          <!--[php]-->
            if($sum_percent_all_count_sungmen_unknown >=91 && $sum_percent_all_count_sungmen_unknown <= 100){
              echo '<th width="10%" bgcolor ="#0099ff" >';
              echo $sum_percent_all_count_sungmen_unknown;
              echo '</th>';
            }else if($sum_percent_all_count_sungmen_unknown >=71 && $sum_percent_all_count_sungmen_unknown < 91){
              echo '<th width="10%" bgcolor ="#33cc00" >';
              echo $sum_percent_all_count_sungmen_unknown;
              echo '</th>';
            }else if($sum_percent_all_count_sungmen_unknown >=51 && $sum_percent_all_count_sungmen_unknown < 71){
              echo '<th width="10%" bgcolor ="#ffffcc" >';
              echo $sum_percent_all_count_sungmen_unknown;
              echo '</th>';
            }else if($sum_percent_all_count_sungmen_unknown >=1 && $sum_percent_all_count_sungmen_unknown < 51){
              echo '<th width="10%" bgcolor ="#ff3300" >';
              echo $sum_percent_all_count_sungmen_unknown;
              echo '</th>';
            }else if($sum_percent_all_count_sungmen_unknown < 1){
              echo '<th width="10%" bgcolor ="#ffccff" >';
              echo $sum_percent_all_count_sungmen_unknown;
              echo '</th>';
            }
          <!--[/php]-->
      </tr>
      <tr>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td></td>
        <td></td>
        <td></td>
        <td></td>
        <td></td>
        <td colspan="2">
          <table width="100%">
            <tr>
              <td bgcolor="#0099ff" width="5%">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
              <td width="95%">&nbsp;ระดับคะแนน (91% - 100%)</td> 
            </tr>
          </table>
        </td>
        <td colspan="2">
          <table width="100%">
            <tr>
              <td bgcolor="#ff3300" width="5%">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
              <td width="95%">&nbsp;ระดับคะแนน (1% - 50%)</td> 
            </tr>
          </table>
        </td>
      </tr>
      <tr>
        <td></td>
        <td></td>
        <td></td>
        <td></td>
        <td></td>
        <td colspan="2">
          <table width="100%">
            <tr>
              <td bgcolor="#33cc00" width="5%">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
              <td width="95%">&nbsp;ระดับคะแนน (71% - 90s%)</td> 
            </tr>
          </table>
        </td>
        <td colspan="2">
          <table width="100%">
            <tr>
              <td bgcolor="#ffccff" width="5%">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
              <td width="95%">&nbsp;ระดับคะแนน (0%)</td> 
            </tr>
          </table>
        </td>
      </tr>
      <tr>
        <td></td>
        <td></td>
        <td></td>
        <td></td>
        <td></td>
        <td colspan="2">
          <table width="100%">
            <tr>
              <td bgcolor="#ffffcc" width="5%">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
              <td width="95%">&nbsp;ระดับคะแนน (51% - 70%)</td> 
            </tr>
          </table>
        </td>
        <td colspan="2">
          &nbsp;
        </td>
      </tr>
    </table>
<br>
  <!--[/if]-->




</form>
</fieldset>




<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<title>Google Maps JavaScript API v3 Example: Info Window Simple</title>
<link href="http://code.google.com/apis/maps/documentation/javascript/examples/default.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
<script type="text/javascript">


function detectBrowser() {
  var useragent = navigator.userAgent;
  var mapdiv = document.getElementById("map_canvas");
    
  if (useragent.indexOf('iPhone') != -1 || useragent.indexOf('Android') != -1 ) {
    mapdiv.style.width = '100%';
    mapdiv.style.height = '100%';
  } else {
    mapdiv.style.width = '100%';
    mapdiv.style.height = '800px';
  }
}

  function initialize() {
  
    detectBrowser();
    //$selected, $notselected
    var myLatlng = new google.maps.LatLng(13.759127,100.565185);
    var myOptions = {
      scrollwheel: false,
      zoom: 6,
      center: myLatlng,
      mapTypeId: google.maps.MapTypeId.HYBRID
    }

    var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
    //'http://www.google.com/mapfiles/marker.png'
    var data = [
                     <!--[foreach from=$objectArray item=item]-->
                      [
                        ' ', 
                        '<!--[$item.name]-->', 
                        <!--[$item.latitude]-->,
                         <!--[$item.longitude]-->, 
                        1,
                      'http://maps.gstatic.com/intl/th_ALL/mapfiles/ms/micons/rangerstation.png'
                      ],
                     <!--[/foreach]-->
                  ];

      setMarkers(map, data);
    }

function makeMarker(imageName){
  //alert(imageName);
  var iconImage = new google.maps.MarkerImage(imageName,
      // This marker is 20 pixels wide by 34 pixels tall.
      new google.maps.Size(20, 34),
      // The origin for this image is 0,0.
      new google.maps.Point(0,0),
      // The anchor for this image is at 9,34.
      new google.maps.Point(9, 34));
    return iconImage;
}

function makeShadow(){
  var iconShadow = new google.maps.MarkerImage('http://www.google.com/mapfiles/shadow50.png',
      // The shadow image is larger in the horizontal dimension
      // while the position and offset are the same as for the main image.
      new google.maps.Size(37, 34),
      new google.maps.Point(0,0),
      new google.maps.Point(9, 34));
    return iconShadow;
}
  
  function setMarkers(map, locations) {

    for (var i = 0; i < locations.length; i++) {
      var data = locations[i];
      var myLatLng = new google.maps.LatLng(data[2], data[3]);
     var marker = new google.maps.Marker({
          position: myLatLng,
          map: map,
          //shadow: makeShadow(),
          icon: data[5],
          //shape: shape,
          title: data[1],
          zIndex: data[4]
      });

                   
    var contentString = data[1];
        
    var infowindow = new google.maps.InfoWindow({
        content: contentString
    });
/*    
    google.maps.event.addListener(marker, 'click', function() {
      infowindow.open(map,marker);
    });
    */
    
    google.maps.event.addListener(marker, 'click', infoCallback(infowindow, marker));
    
    }
    
    function infoCallback(infowindow, marker) {
      return function() {
      infowindow.open(map, marker);
      };
    }
  }
</script>
</head>
<br>
<!-- Map -->
<fieldset>
  <legend>&nbsp;Report&nbsp;Map&nbsp;</legend>
<body onload="initialize()">
  <div id="map_canvas" style="position:relative;"></div>
</body>